<template>
	<view class="container">
		<u-radio-group v-model="value" @change="radioGroupChange" wrap class="radio-group">
			<u-radio  class="radio-item" v-for="(item, index) in list" :key="index" :name="item.value">
				{{item.name}}
			</u-radio>
		</u-radio-group>
	</view>
</template>

<script>
	import {
		mapGetters,mapMutations
	} from "vuex"
	export default {
		data() {
			return {
				list: [{
						name: '红涨绿跌',
						value: "red"
					},
					{
						name: '绿涨红跌',
						value: "green"
					},

				],
				value: "red"
			};
		},
		computed:{
			...mapGetters("user",["getColorUp"])
		},
		methods: {
			...mapMutations("user",["modifyColorUp"]),
			radioGroupChange(e) {
				this.modifyColorUp(e)
			}
		},
		onLoad() {
			this.value=this.getColorUp
		}
	}
</script>

<style lang="scss">
.container{
	.radio-group{
		padding: 0 30rpx;
		width: 100%;
		background-color: #fff;
	}
	.radio-item{
		padding: 10rpx 0;
		justify-content: space-between;
		flex-direction: row-reverse;
	}
}
</style>
